<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>

<body>
</body>
</html>
<script>
	function numTestCode(n){
		var arr = [];
		for(var i = 0; i < n;i++) {
			var num = parseInt(Math.random()*123);
			if(num>=0 && num<=9){
				arr.push(num)
				
			}else if(num>=65 && num<=90 || num>=97 && num<=122){
				arr.push(String.fromCharCode(num))
			}else{
				i--
			}
		}
		return arr.join("");
	}
	
	alert(numTestCode(4))
</script>
